package com.dodo.videoEdit.ui.fragment.adapters;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.viewpager2.adapter.FragmentStateAdapter;

import java.util.ArrayList;

/**
 * @author zhoubo
 * @date 2020/8/12
 * @describe
 */
public class FragmentPagerAdapter extends FragmentStateAdapter {
    ArrayList<Fragment> arrayList = new ArrayList<>();
    public FragmentPagerAdapter(@NonNull FragmentActivity fragmentActivity, ArrayList<Fragment> list) {
        super(fragmentActivity);
        this.arrayList = list;
    }

    @Override
    public Fragment createFragment(int position) {
        return arrayList.get(position);
    }

    @Override
    public int getItemCount() {
        return arrayList.size();
    }
}